﻿package view.component
{
    import com.greensock.*;
    import uiresource.*;

    public class SmallLoading extends LoadingUI
    {
        private var pec:Number = 0;
        private var max:int = 214;
        private var _tween:TweenLite;
        private var _func:Function;

        public function SmallLoading()
        {
            return;
        }// end function

        override protected function initialize() : void
        {
            super.initialize();
            this.barbg.width = this.max;
            return;
        }// end function

        public function start(param1:Array = null) : void
        {
            this.visible = true;
            this.progress = 0;
            var _loc_2:Boolean = true;
            var _loc_3:String = "";
            if (param1)
            {
                if (param1.length > 0)
                {
                    _loc_2 = param1[0];
                }
                if (param1.length > 1)
                {
                    _loc_3 = param1[1];
                }
                if (param1.length > 2)
                {
                    this._func = param1[2];
                }
            }
            if (_loc_2)
            {
                if (this._tween)
                {
                    this._tween.kill();
                }
                this._tween = TweenLite.to(this, 3, {progress:1, onComplete:this.completeHandler});
            }
            this.label1.text = _loc_3;
            return;
        }// end function

        private function completeHandler() : void
        {
            if (this._tween)
            {
                this._tween = null;
            }
            if (this._func != null)
            {
                this._func();
                this._func = null;
            }
            return;
        }// end function

        public function set progress(param1:Number) : void
        {
            this.pec = param1;
            this.bar.width = param1 * this.max;
            return;
        }// end function

        public function get progress() : Number
        {
            return this.pec;
        }// end function

        public function end() : void
        {
            if (this._tween)
            {
                this._tween.kill();
                this._tween = null;
            }
            this.visible = false;
            return;
        }// end function

    }
}
